package difangame.level;

import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import difangame.sprite.Frog;
import framework.Level;
import framework.Sprite;


/**
 * 
 * @author difan
 * 
 */

public class Level1 extends Level {

    private Image mySplash;
    private int myWidth = 305;
    private int myHeight = 256;
    private Sprite mySprite;
    private final int myNextLevelIfWin = 2; // changed

    @Override
    protected void initializeLevel () {
        mySplash = super.getMyGame().loadImage("start.gif");
    }

    @Override
    protected int testWinCondition () {
        if (getMyGame().getMyContainer().getLastKeyPressed().equalsIgnoreCase("s")) {
            return myNextLevelIfWin;
        }
        return -1;
    }

    @Override
    protected int testLoseCondition () {
        // no lose condition for splash screen
        return -1;

    }

    @Override
    protected void levelBehavior () {
        // no behavior

    }

    @Override
    protected void loadLevelObjects () {
        mySprite = new Frog();
        mySprite.initialize(new Point(0, 0), this);

    }

    private Dimension getAppletBounds () {
        return getMyGame().getMyContainer().getSize();
    }

    @Override
    protected void paint (Graphics2D pen) {
        Dimension bounds = getAppletBounds();
        pen.drawImage(mySplash, bounds.width / 2 - myWidth / 2, bounds.height / 2 - myHeight / 2,
                      myWidth, myHeight, null);

    }

}
